<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>文章 - 博客管理系统</title>
<link rel="stylesheet" type="text/css" href="/admin/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/admin/css/style.css">
<link rel="stylesheet" type="text/css" href="/admin/css/font-awesome.min.css">
<link rel="apple-touch-icon-precomposed" href="/admin/images/icon/icon.png">
<link rel="shortcut icon" href="/admin/images/icon/favicon.ico">
<script src="/admin/js/jquery-2.1.4.min.js"></script>
<script src="/layer/layer.js"></script>
</head>
<body class="user-select" style="margin: 0px;padding: 0px;">

      <form action="/back/article/list?page=1" method="post" class="form-inline" >
      	<div>
      		<ul class="breadcrumb" style="margin: 0px;">
      			<li>文章管理</li>
      			<li>文章查询</li>
      		</ul>
      	</div>
   		<div class="row alert alert-info">
   				<div class="form-group">
   					<input type="text" name="articleTitle" class="form-control" value="${(article.articleTitle)!}" placeholder="请输入文章的标题"/>
                    <select name="categoryId" class="form-control">
                        <option value="">请选择</option>
                        <#list (allCategory)! as category>
                            <option value="${(category.categoryId)!}"
                            <#if  article.categoryId??>
                                    <#if  category.categoryId ==article.categoryId>
                                    selected
                                </#if>
                              </#if>
                        >
                             ${(category.categoryName)!}
                            </option>
                        </#list>
                    </select>


   					<input type="submit" value="查询" class="btn btn-info "/>
   					<a href="/back/article/add" class="btn btn-info ">增加文章</a>
   				
   				</div>
   		</div>
   
     
        <div class="table-responsive">
          <table class="table table-striped table-hover">
            <thead>
              <tr>
                <th>选择</th>
                <th>标题</th>
                <th>栏目</th>
                <th>日期</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
            <#list (pageBean.list) as article>
              <tr>
                <td><input type="checkbox" class="input-control" name="checkbox[]" value="" /></td>
                <td class="article-title">${(article.articleTitle)!}</td>
                <td>${(article.categoryName)!}</td>
                <td>
                    <#if article.articleTime??>
                    ${(article.articleTime)?string("yyyy年MM月dd日 HH:mm:ss")}
                    <#else>
                    </#if>
                </td>
                <td><a href="/back/article/update?articleId=${(article.articleId)!} ">修改</a> <a rel="6" href="javascript:void(0)" onclick="deleteArticle(${(article.articleId)!})">删除</a></td>
              </tr>
            </#list>
            </tbody>
          </table>
            共有${pageBean.allRow}条记录，当前是第${pageBean.currentPage}/${pageBean.totalPage}页
            <nav >
                <ul class="pager">
                    <#if pageBean.currentPage == 1>
                    第一页 上一页
                    <#else>
                    <li><a href="/back/article/list?page=1&articleTitle=${(article.articleTitle)!}&categoryId=${(article.categoryId)!}">第一页</a></li>
                    <li><a href="/back/article/list?page=${pageBean.currentPage-1}&articleTitle=${(article.articleTitle)!}&categoryId=${(article.categoryId)!}">上一页</a></li>
                </#if>
                <#if pageBean.currentPage == pageBean.totalPage>
                下一页 最末页
                <#else>
                <li><a href="/back/article/list?page=${pageBean.currentPage+1}&articleTitle=${(article.articleTitle)!}&categoryId=${(article.categoryId)!}">下一页</a></li>
                <li><a href="/back/article/list?page=${pageBean.totalPage}&articleTitle=${(article.articleTitle)!}&categoryId=${(article.categoryId)!}">最末页</a></li>
            </#if>
            </ul>
        </div>

      </form>
<script src="/admin/js/bootstrap.min.js"></script> 
<script src="/admin/js/admin-scripts.js"></script>
<script type="text/javascript">

    function deleteArticle(articleId) {
        layer.confirm('是否删除该文章？',
            {
                btn:['是','否'],//按钮
                icon:2   //图标
            },
            function () {
                location.href = "/back/article/delete?articleId=" + articleId;
            }
        )

    }
</script>
</body>
</html>
